package com.project.controller;


import com.project.bean.InfoBean;
import com.project.service.IInfoService;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("info")
public class InfoController {
    @Autowired
    IInfoService service;
    @PostMapping("add")
    public String add(@RequestBody InfoBean info){
        service.add(info);
        return "ok";
    }
    @GetMapping("findAll")
    public List<InfoBean> findAll(){
        return service.findAll();
    }

    @PutMapping("update/{orderNum}/{state}")
    public String update (@PathVariable("orderNum") String orderNum,@PathVariable("state") String state){
        service.update(orderNum,state);
        return "ok";
    }
}
